package edu.whu.webgis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.whu.webgis.entity.Footprint;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface FootprintMapper extends BaseMapper<Footprint> {
    @Select("select * from footprint where id = #{id}")
    List<Footprint> selectByUserId(String id);

    @Insert("insert into footprint(id,year,lon,lat,province,city) values(#{id},#{year},#{lon},#{lat},#{province},#{city})")
    int insertFootprint(Footprint footprint);

    @Select("SELECT province from footprint GROUP BY(province) ORDER BY count(province) desc LIMIT 3")
    List<String> selectHfProvince();

    @Select("SELECT DISTINCT city,lon,lat FROM footprint")
    List<Map<String,Object>> getCityBase();
}
